import javax.swing.*;

public class TeacherPanel extends JFrame {
    public TeacherPanel(Teacher teacher) {
        setTitle("教师面板");
        setSize(400, 300);
        setDefaultCloseOperation(JFrame.DISPOSE_ON_CLOSE);

        JPanel panel = new JPanel();
        add(panel);
        placeComponents(panel, teacher);
    }

    private void placeComponents(JPanel panel, Teacher teacher) {
        panel.setLayout(null);

        JLabel infoLabel = new JLabel("教师信息");
        infoLabel.setBounds(10, 20, 80, 25);
        panel.add(infoLabel);

        JLabel idLabel = new JLabel("工号: " + teacher.getId());
        idLabel.setBounds(10, 50, 300, 25);
        panel.add(idLabel);

        JLabel nameLabel = new JLabel("姓名: " + teacher.getName());
        nameLabel.setBounds(10, 80, 300, 25);
        panel.add(nameLabel);

        JLabel ageLabel = new JLabel("年龄: " + teacher.getAge());
        ageLabel.setBounds(10, 110, 300, 25);
        panel.add(ageLabel);

        JLabel subjectLabel = new JLabel("任职科目: " + teacher.getSubject());
        subjectLabel.setBounds(10, 140, 300, 25);
        panel.add(subjectLabel);

        JLabel scheduleLabel = new JLabel("课表: " + teacher.getSchedule());
        scheduleLabel.setBounds(10, 170, 300, 25);
        panel.add(scheduleLabel);
    }
}
